<%@ page import="ztc.common.StuBean" %>
<%@ page import="java.util.concurrent.ConcurrentHashMap" %>
<%@ page import="ztc.common.SiginBean" %>
<%@ page import="ztc.common.UserBean" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.net.URLEncoder" %>
<%--
  Created by IntelliJ IDEA.
  User: ztc
  Date: 16-4-20
  Time: 下午3:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>未保存签到</title>
  <link href="${pageContext.request.contextPath}/css/min.css" rel="stylesheet">
  <link href="${pageContext.request.contextPath}/css/login.css" rel="stylesheet">
  <script src="${pageContext.request.contextPath}/js/jquery.js"></script>
  <script src="${pageContext.request.contextPath}/js/min.js"></script>
  <script src="${pageContext.request.contextPath}/js/my.js"></script>
  <link rel="shortcut icon" type="image/x-icon" href="${pageContext.request.contextPath}/img/favicon.ico" />
</head>
<%
  ConcurrentHashMap<String,ConcurrentHashMap<String,StuBean>> aMap=
          (ConcurrentHashMap<String, ConcurrentHashMap<String, StuBean>>) application.getAttribute("sessionID");
  SiginBean siginBean= (SiginBean) session.getAttribute("siginBean");
  if(siginBean==null||aMap==null){
    response.sendRedirect("/qr/issuance.jsp?msg="+ URLEncoder.encode("没有未保存的签到！","utf-8"));
  }else{
    ConcurrentHashMap<String,StuBean> sMap=
            aMap.get(session.getId());
    List<StuBean> list=new ArrayList<StuBean>();
    Set set=sMap.keySet();
    for(Object s:set){
      if(sMap.get(s).getName()!="null")
        list.add(sMap.get(s));
    }
%>
<body>
<div style="position:fixed;top: 20px; background:#ccc;height:50px;width:98%;left:1%;z-index:1;" id="topbar">
  <img src="/img/0.png" height="40px" style="position: relative;top: 10%;left: 5%;z-index: 2;">
  <img src="/img/135-round.png" height="40px" style="position: relative;top: 10%;">
  <img src="/img/435-round.png" height="40px" style="position: relative;top: 10%;">
  <label style="position: relative;top: 20%;">×××××××××× ××××××××××</label>
  <a href="/qr/issuance.jsp"><label style="position: relative;top: 20%;left:10%;">发布签到</label></a>
  <a href="/qr/showmem.jsp"><label style="position: relative;top: 20%;left:20%;">查看未保存布签到</label></a>
  <a href="/qr/showinf.jsp"><label style="position: relative;top: 20%;left:30%;">查看已保存布签到</label></a>
  <label style="position: relative;top: 20%;left:45%;" >
    <%=(session.getAttribute("userBean")==null?"<a href=\"/users/register.jsp\">注册</a>":"用户："+((UserBean)session.getAttribute("userBean")).getName())+"<a href=\"/users/logout\">注销</a> "%></label>
</div>
<div class="container-fluid" style="position: relative;top:40px;">
  <div class="row-fluid">
    <div class="span12">
      <div class="row-fluid">
        <a href="/users/save?action=save"><button type="submit" id="save" class="btn btn-primary btn-block btn-lg" style="float:left;width: 50%;left: 1%;">保存</button></a>
        <a href="/users/save?action=delete"><button type="submit" id="delete" class="btn btn-primary btn-block btn-lg" style="width: 50%;right: 1%;">删除</button></a>
        <div  align="center">
          <fieldset>
            <legend>[<%=siginBean.getSname()%>]签到<%=list.size()%>人</legend>
            <table class="table" id="table">
              <tr align="center"><td><B>学号</B></td><td><B>姓名</B></td><td><B>MAC</B></td><td><B>签到时间</B></td></tr>
              <%
                for(StuBean s:list){
                  out.println("<tr align=\"center\">");
                  out.println("<td>"+s.getStuID()+"</td>");
                  out.println("<td>"+s.getName()+"</td>");
                  out.println("<td>"+s.getMac()+"</td>");
                  out.println("<td>"+s.getTime()+"</td>");
                  out.println("</tr>");
                }
              %>
            </table>
          </fieldset>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
<%}%>
</html>
